#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/time.h>
#include <signal.h>

void hello(int sig){
    printf("hello\n");
}


int main(){
    struct itimerval itime;
    itime.it_interval.tv_sec = 10;
    itime.it_interval.tv_usec = 0;
    itime.it_value.tv_sec = 10;
    itime.it_value.tv_usec = 0;

    signal(SIGALRM, hello);
    setitimer(ITIMER_REAL, &itime, NULL);
    while(1){
        struct itimerval temp;
        getitimer(ITIMER_REAL, &temp);
        printf("%ld\n", temp.it_interval.tv_sec);
        printf("%ld\n", temp.it_interval.tv_usec);
        printf("%ld\n", temp.it_value.tv_sec);
        printf("%ld\n", temp.it_value.tv_usec);
        printf("\n\n");
        sleep(1);
    }
    return 0;
}